{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "466df0c5-b6c9-4de5-ac6b-51cf808bde02",
   "metadata": {},
   "source": [
    "# Working With Scientific Notation\n",
    "\n",
    "The `exponent_format` parameter in the `theme(...)` function can be used to configure the way \"exponent notation\" looks like on plot.\n",
    "\n",
    "Available values:\n",
    "\n",
    "- `\"e\"` for \"e\" notation (e.g. 1e+6);\n",
    "- `\"pow_full\"` for \"power\" notation (e.g. $1 \\cdot 10^6$). This will enable superscript formatting for the exponent;\n",
    "- `\"pow\"` works as `\"pow_full\"` but will shorten powers of 10 (e.g. $10^6$ instead of $1 \\cdot 10^6$).\n",
    "\n",
    "The \"exponent format\" is automatically applied to each value formatted in scientific notation, regardless whether the format is user-defined or chosen automatically based on the data. This format affects every part of a plot, including geoms, scales, labels, and tooltips."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "49f9e2d9-d59b-43b8-ac5d-00eb435c23d9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "            <div id=\"kotlin_out_0\"></div>\n",
       "            <script type=\"text/javascript\">\n",
       "                            if(!window.kotlinQueues) {\n",
       "                window.kotlinQueues = {};\n",
       "            }\n",
       "            if(!window.kotlinQueues[\"DataFrame\"]) {\n",
       "                var resQueue = [];\n",
       "                window.kotlinQueues[\"DataFrame\"] = resQueue;\n",
       "                window[\"call_DataFrame\"] = function(f) {\n",
       "                    resQueue.push(f);\n",
       "                }\n",
       "            }\n",
       "            (function (){\n",
       "                var modifiers = [(function(script) {\n",
       "    script.src = \"https://cdn.jsdelivr.net/gh/Kotlin/dataframe@3db46ccccaa1291c0627307d64133317f545e6ae/core/src/main/resources/init.js\"\n",
       "    script.type = \"text/javascript\";\n",
       "})];\n",
       "                var e = document.getElementById(\"kotlin_out_0\");\n",
       "                modifiers.forEach(function (gen) {\n",
       "                    var script = document.createElement(\"script\");\n",
       "                    gen(script)\n",
       "                    script.addEventListener(\"load\", function() {\n",
       "                        window[\"call_DataFrame\"] = function(f) {f();};\n",
       "                        window.kotlinQueues[\"DataFrame\"].forEach(function(f) {f();});\n",
       "                        window.kotlinQueues[\"DataFrame\"] = [];\n",
       "                    }, false);\n",
       "                    script.addEventListener(\"error\", function() {\n",
       "                        window[\"call_DataFrame\"] = function(f) {};\n",
       "                        window.kotlinQueues[\"DataFrame\"] = [];\n",
       "                        var div = document.createElement(\"div\");\n",
       "                        div.style.color = 'darkred';\n",
       "                        div.textContent = 'Error loading resource DataFrame';\n",
       "                        document.getElementById(\"kotlin_out_0\").appendChild(div);\n",
       "                    }, false);\n",
       "                    \n",
       "                    e.appendChild(script);\n",
       "                });\n",
       "            })();\n",
       "            </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "                <style>\n",
       "                :root {\n",
       "    --background: #fff;\n",
       "    --background-odd: #f5f5f5;\n",
       "    --background-hover: #d9edfd;\n",
       "    --header-text-color: #474747;\n",
       "    --text-color: #848484;\n",
       "    --text-color-dark: #000;\n",
       "    --text-color-medium: #737373;\n",
       "    --text-color-pale: #b3b3b3;\n",
       "    --inner-border-color: #aaa;\n",
       "    --bold-border-color: #000;\n",
       "    --link-color: #296eaa;\n",
       "    --link-color-pale: #296eaa;\n",
       "    --link-hover: #1a466c;\n",
       "}\n",
       "\n",
       ":root[theme=\"dark\"], :root [data-jp-theme-light=\"false\"], .dataframe_dark{\n",
       "    --background: #303030;\n",
       "    --background-odd: #3c3c3c;\n",
       "    --background-hover: #464646;\n",
       "    --header-text-color: #dddddd;\n",
       "    --text-color: #b3b3b3;\n",
       "    --text-color-dark: #dddddd;\n",
       "    --text-color-medium: #b2b2b2;\n",
       "    --text-color-pale: #737373;\n",
       "    --inner-border-color: #707070;\n",
       "    --bold-border-color: #777777;\n",
       "    --link-color: #008dc0;\n",
       "    --link-color-pale: #97e1fb;\n",
       "    --link-hover: #00688e;\n",
       "}\n",
       "\n",
       "p.dataframe_description {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe {\n",
       "    font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n",
       "    font-size: 12px;\n",
       "    background-color: var(--background);\n",
       "    color: var(--text-color-dark);\n",
       "    border: none;\n",
       "    border-collapse: collapse;\n",
       "}\n",
       "\n",
       "table.dataframe th, td {\n",
       "    padding: 6px;\n",
       "    border: 1px solid transparent;\n",
       "    text-align: left;\n",
       "}\n",
       "\n",
       "table.dataframe th {\n",
       "    background-color: var(--background);\n",
       "    color: var(--header-text-color);\n",
       "}\n",
       "\n",
       "table.dataframe td {\n",
       "    vertical-align: top;\n",
       "}\n",
       "\n",
       "table.dataframe th.bottomBorder {\n",
       "    border-bottom-color: var(--bold-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:nth-child(odd) {\n",
       "    background: var(--background-odd);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:nth-child(even) {\n",
       "    background: var(--background);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:hover {\n",
       "    background: var(--background-hover);\n",
       "}\n",
       "\n",
       "table.dataframe a {\n",
       "    cursor: pointer;\n",
       "    color: var(--link-color);\n",
       "    text-decoration: none;\n",
       "}\n",
       "\n",
       "table.dataframe tr:hover > td a {\n",
       "    color: var(--link-color-pale);\n",
       "}\n",
       "\n",
       "table.dataframe a:hover {\n",
       "    color: var(--link-hover);\n",
       "    text-decoration: underline;\n",
       "}\n",
       "\n",
       "table.dataframe img {\n",
       "    max-width: fit-content;\n",
       "}\n",
       "\n",
       "table.dataframe th.complex {\n",
       "    background-color: var(--background);\n",
       "    border: 1px solid var(--background);\n",
       "}\n",
       "\n",
       "table.dataframe .leftBorder {\n",
       "    border-left-color: var(--inner-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe .rightBorder {\n",
       "    border-right-color: var(--inner-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe .rightAlign {\n",
       "    text-align: right;\n",
       "}\n",
       "\n",
       "table.dataframe .expanderSvg {\n",
       "    width: 8px;\n",
       "    height: 8px;\n",
       "    margin-right: 3px;\n",
       "}\n",
       "\n",
       "table.dataframe .expander {\n",
       "    display: flex;\n",
       "    align-items: center;\n",
       "}\n",
       "\n",
       "/* formatting */\n",
       "\n",
       "table.dataframe .null {\n",
       "    color: var(--text-color-pale);\n",
       "}\n",
       "\n",
       "table.dataframe .structural {\n",
       "    color: var(--text-color-medium);\n",
       "    font-weight: bold;\n",
       "}\n",
       "\n",
       "table.dataframe .dataFrameCaption {\n",
       "    font-weight: bold;\n",
       "}\n",
       "\n",
       "table.dataframe .numbers {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe td:hover .formatted .structural, .null {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe tr:hover .formatted .structural, .null {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "\n",
       "                </style>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "   <div id=\"Jo33Ij\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
       "       if(!window.letsPlotCallQueue) {\n",
       "           window.letsPlotCallQueue = [];\n",
       "       }; \n",
       "       window.letsPlotCall = function(f) {\n",
       "           window.letsPlotCallQueue.push(f);\n",
       "       };\n",
       "       (function() {\n",
       "           var script = document.createElement(\"script\");\n",
       "           script.type = \"text/javascript\";\n",
       "           script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.5.1/js-package/distr/lets-plot.min.js\";\n",
       "           script.onload = function() {\n",
       "               window.letsPlotCall = function(f) {f();};\n",
       "               window.letsPlotCallQueue.forEach(function(f) {f();});\n",
       "               window.letsPlotCallQueue = [];\n",
       "               \n",
       "               \n",
       "           };\n",
       "           script.onerror = function(event) {\n",
       "               window.letsPlotCall = function(f) {};\n",
       "               window.letsPlotCallQueue = [];\n",
       "               var div = document.createElement(\"div\");\n",
       "               div.style.color = 'darkred';\n",
       "               div.textContent = 'Error loading Lets-Plot JS';\n",
       "               document.getElementById(\"Jo33Ij\").appendChild(div);\n",
       "           };\n",
       "           var e = document.getElementById(\"Jo33Ij\");\n",
       "           e.appendChild(script);\n",
       "       })();\n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%useLatestDescriptors\n",
    "%use dataframe\n",
    "%use lets-plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "12bd6f55-ef7b-4979-8145-96887c3a1408",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Lets-Plot Kotlin API v.4.9.0. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.5.1."
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "LetsPlot.getInfo()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "7cb63b83-6326-4773-b4c8-71b824ad982c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import org.jetbrains.letsPlot.intern.Plot\n",
    "import org.jetbrains.letsPlot.intern.Scale"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "6e545d5e-a0ae-4f86-9d83-66a322fa34a5",
   "metadata": {},
   "outputs": [],
   "source": [
    "val amuCoeffNG = 1.6605402 * 10.0.pow(-15)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "955752f1-c671-4eb2-93a9-e96ad56968ba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/kotlindataframe+json": "{\"nrow\":5,\"ncol\":5,\"columns\":[\"Name\",\"Symbol\",\"Type\",\"Weight (ng)\",\"Radius\"],\"kotlin_dataframe\":[{\"Name\":\"Hydrogen\",\"Symbol\":\"H\",\"Type\":\"Nonmetal\",\"Weight (ng)\":1.6737248891880002E-15,\"Radius\":0.79},{\"Name\":\"Helium\",\"Symbol\":\"He\",\"Type\":\"Noble Gas\",\"Weight (ng)\":6.646481525600401E-15,\"Radius\":0.49},{\"Name\":\"Lithium\",\"Symbol\":\"Li\",\"Type\":\"Alkali Metal\",\"Weight (ng)\":1.15258095282E-14,\"Radius\":2.1},{\"Name\":\"Beryllium\",\"Symbol\":\"Be\",\"Type\":\"Alkaline Earth Metal\",\"Weight (ng)\":1.49650905007164E-14,\"Radius\":1.4},{\"Name\":\"Boron\",\"Symbol\":\"B\",\"Type\":\"Metalloid\",\"Weight (ng)\":1.79521001022E-14,\"Radius\":1.2}]}",
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                :root {\n",
       "    --background: #fff;\n",
       "    --background-odd: #f5f5f5;\n",
       "    --background-hover: #d9edfd;\n",
       "    --header-text-color: #474747;\n",
       "    --text-color: #848484;\n",
       "    --text-color-dark: #000;\n",
       "    --text-color-medium: #737373;\n",
       "    --text-color-pale: #b3b3b3;\n",
       "    --inner-border-color: #aaa;\n",
       "    --bold-border-color: #000;\n",
       "    --link-color: #296eaa;\n",
       "    --link-color-pale: #296eaa;\n",
       "    --link-hover: #1a466c;\n",
       "}\n",
       "\n",
       ":root[theme=\"dark\"], :root [data-jp-theme-light=\"false\"], .dataframe_dark{\n",
       "    --background: #303030;\n",
       "    --background-odd: #3c3c3c;\n",
       "    --background-hover: #464646;\n",
       "    --header-text-color: #dddddd;\n",
       "    --text-color: #b3b3b3;\n",
       "    --text-color-dark: #dddddd;\n",
       "    --text-color-medium: #b2b2b2;\n",
       "    --text-color-pale: #737373;\n",
       "    --inner-border-color: #707070;\n",
       "    --bold-border-color: #777777;\n",
       "    --link-color: #008dc0;\n",
       "    --link-color-pale: #97e1fb;\n",
       "    --link-hover: #00688e;\n",
       "}\n",
       "\n",
       "p.dataframe_description {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe {\n",
       "    font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n",
       "    font-size: 12px;\n",
       "    background-color: var(--background);\n",
       "    color: var(--text-color-dark);\n",
       "    border: none;\n",
       "    border-collapse: collapse;\n",
       "}\n",
       "\n",
       "table.dataframe th, td {\n",
       "    padding: 6px;\n",
       "    border: 1px solid transparent;\n",
       "    text-align: left;\n",
       "}\n",
       "\n",
       "table.dataframe th {\n",
       "    background-color: var(--background);\n",
       "    color: var(--header-text-color);\n",
       "}\n",
       "\n",
       "table.dataframe td {\n",
       "    vertical-align: top;\n",
       "}\n",
       "\n",
       "table.dataframe th.bottomBorder {\n",
       "    border-bottom-color: var(--bold-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:nth-child(odd) {\n",
       "    background: var(--background-odd);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:nth-child(even) {\n",
       "    background: var(--background);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:hover {\n",
       "    background: var(--background-hover);\n",
       "}\n",
       "\n",
       "table.dataframe a {\n",
       "    cursor: pointer;\n",
       "    color: var(--link-color);\n",
       "    text-decoration: none;\n",
       "}\n",
       "\n",
       "table.dataframe tr:hover > td a {\n",
       "    color: var(--link-color-pale);\n",
       "}\n",
       "\n",
       "table.dataframe a:hover {\n",
       "    color: var(--link-hover);\n",
       "    text-decoration: underline;\n",
       "}\n",
       "\n",
       "table.dataframe img {\n",
       "    max-width: fit-content;\n",
       "}\n",
       "\n",
       "table.dataframe th.complex {\n",
       "    background-color: var(--background);\n",
       "    border: 1px solid var(--background);\n",
       "}\n",
       "\n",
       "table.dataframe .leftBorder {\n",
       "    border-left-color: var(--inner-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe .rightBorder {\n",
       "    border-right-color: var(--inner-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe .rightAlign {\n",
       "    text-align: right;\n",
       "}\n",
       "\n",
       "table.dataframe .expanderSvg {\n",
       "    width: 8px;\n",
       "    height: 8px;\n",
       "    margin-right: 3px;\n",
       "}\n",
       "\n",
       "table.dataframe .expander {\n",
       "    display: flex;\n",
       "    align-items: center;\n",
       "}\n",
       "\n",
       "/* formatting */\n",
       "\n",
       "table.dataframe .null {\n",
       "    color: var(--text-color-pale);\n",
       "}\n",
       "\n",
       "table.dataframe .structural {\n",
       "    color: var(--text-color-medium);\n",
       "    font-weight: bold;\n",
       "}\n",
       "\n",
       "table.dataframe .dataFrameCaption {\n",
       "    font-weight: bold;\n",
       "}\n",
       "\n",
       "table.dataframe .numbers {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe td:hover .formatted .structural, .null {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe tr:hover .formatted .structural, .null {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "\n",
       ":root {\n",
       "    --background: #fff;\n",
       "    --background-odd: #f5f5f5;\n",
       "    --background-hover: #d9edfd;\n",
       "    --header-text-color: #474747;\n",
       "    --text-color: #848484;\n",
       "    --text-color-dark: #000;\n",
       "    --text-color-medium: #737373;\n",
       "    --text-color-pale: #b3b3b3;\n",
       "    --inner-border-color: #aaa;\n",
       "    --bold-border-color: #000;\n",
       "    --link-color: #296eaa;\n",
       "    --link-color-pale: #296eaa;\n",
       "    --link-hover: #1a466c;\n",
       "}\n",
       "\n",
       ":root[theme=\"dark\"], :root [data-jp-theme-light=\"false\"], .dataframe_dark{\n",
       "    --background: #303030;\n",
       "    --background-odd: #3c3c3c;\n",
       "    --background-hover: #464646;\n",
       "    --header-text-color: #dddddd;\n",
       "    --text-color: #b3b3b3;\n",
       "    --text-color-dark: #dddddd;\n",
       "    --text-color-medium: #b2b2b2;\n",
       "    --text-color-pale: #737373;\n",
       "    --inner-border-color: #707070;\n",
       "    --bold-border-color: #777777;\n",
       "    --link-color: #008dc0;\n",
       "    --link-color-pale: #97e1fb;\n",
       "    --link-hover: #00688e;\n",
       "}\n",
       "\n",
       "p.dataframe_description {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe {\n",
       "    font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n",
       "    font-size: 12px;\n",
       "    background-color: var(--background);\n",
       "    color: var(--text-color-dark);\n",
       "    border: none;\n",
       "    border-collapse: collapse;\n",
       "}\n",
       "\n",
       "table.dataframe th, td {\n",
       "    padding: 6px;\n",
       "    border: 1px solid transparent;\n",
       "    text-align: left;\n",
       "}\n",
       "\n",
       "table.dataframe th {\n",
       "    background-color: var(--background);\n",
       "    color: var(--header-text-color);\n",
       "}\n",
       "\n",
       "table.dataframe td {\n",
       "    vertical-align: top;\n",
       "}\n",
       "\n",
       "table.dataframe th.bottomBorder {\n",
       "    border-bottom-color: var(--bold-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:nth-child(odd) {\n",
       "    background: var(--background-odd);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:nth-child(even) {\n",
       "    background: var(--background);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:hover {\n",
       "    background: var(--background-hover);\n",
       "}\n",
       "\n",
       "table.dataframe a {\n",
       "    cursor: pointer;\n",
       "    color: var(--link-color);\n",
       "    text-decoration: none;\n",
       "}\n",
       "\n",
       "table.dataframe tr:hover > td a {\n",
       "    color: var(--link-color-pale);\n",
       "}\n",
       "\n",
       "table.dataframe a:hover {\n",
       "    color: var(--link-hover);\n",
       "    text-decoration: underline;\n",
       "}\n",
       "\n",
       "table.dataframe img {\n",
       "    max-width: fit-content;\n",
       "}\n",
       "\n",
       "table.dataframe th.complex {\n",
       "    background-color: var(--background);\n",
       "    border: 1px solid var(--background);\n",
       "}\n",
       "\n",
       "table.dataframe .leftBorder {\n",
       "    border-left-color: var(--inner-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe .rightBorder {\n",
       "    border-right-color: var(--inner-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe .rightAlign {\n",
       "    text-align: right;\n",
       "}\n",
       "\n",
       "table.dataframe .expanderSvg {\n",
       "    width: 8px;\n",
       "    height: 8px;\n",
       "    margin-right: 3px;\n",
       "}\n",
       "\n",
       "table.dataframe .expander {\n",
       "    display: flex;\n",
       "    align-items: center;\n",
       "}\n",
       "\n",
       "/* formatting */\n",
       "\n",
       "table.dataframe .null {\n",
       "    color: var(--text-color-pale);\n",
       "}\n",
       "\n",
       "table.dataframe .structural {\n",
       "    color: var(--text-color-medium);\n",
       "    font-weight: bold;\n",
       "}\n",
       "\n",
       "table.dataframe .dataFrameCaption {\n",
       "    font-weight: bold;\n",
       "}\n",
       "\n",
       "table.dataframe .numbers {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe td:hover .formatted .structural, .null {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe tr:hover .formatted .structural, .null {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_503316480\"></table>\n",
       "\n",
       "<p class=\"dataframe_description\">DataFrame: rowsCount = 5, columnsCount = 5</p>\n",
       "<table class=\"dataframe\" id=\"static_df_503316481\"><thead><tr><th class=\"bottomBorder\" style=\"text-align:left\">Name</th><th class=\"bottomBorder\" style=\"text-align:left\">Symbol</th><th class=\"bottomBorder\" style=\"text-align:left\">Type</th><th class=\"bottomBorder\" style=\"text-align:left\">Weight (ng)</th><th class=\"bottomBorder\" style=\"text-align:left\">Radius</th></tr></thead><tbody><tr><td  style=\"vertical-align:top\">Hydrogen</td><td  style=\"vertical-align:top\">H</td><td  style=\"vertical-align:top\">Nonmetal</td><td  style=\"vertical-align:top\">0.000000</td><td  style=\"vertical-align:top\">0.790000</td></tr><tr><td  style=\"vertical-align:top\">Helium</td><td  style=\"vertical-align:top\">He</td><td  style=\"vertical-align:top\">Noble Gas</td><td  style=\"vertical-align:top\">0.000000</td><td  style=\"vertical-align:top\">0.490000</td></tr><tr><td  style=\"vertical-align:top\">Lithium</td><td  style=\"vertical-align:top\">Li</td><td  style=\"vertical-align:top\">Alkali Metal</td><td  style=\"vertical-align:top\">0.000000</td><td  style=\"vertical-align:top\">2.100000</td></tr><tr><td  style=\"vertical-align:top\">Beryllium</td><td  style=\"vertical-align:top\">Be</td><td  style=\"vertical-align:top\">Alkaline Earth Metal</td><td  style=\"vertical-align:top\">0.000000</td><td  style=\"vertical-align:top\">1.400000</td></tr><tr><td  style=\"vertical-align:top\">Boron</td><td  style=\"vertical-align:top\">B</td><td  style=\"vertical-align:top\">Metalloid</td><td  style=\"vertical-align:top\">0.000000</td><td  style=\"vertical-align:top\">1.200000</td></tr></tbody></table>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"Name: String\\\">Name</span>\", children: [], rightAlign: false, values: [\"Hydrogen\",\"Helium\",\"Lithium\",\"Beryllium\",\"Boron\"] }, \n",
       "{ name: \"<span title=\\\"Symbol: String\\\">Symbol</span>\", children: [], rightAlign: false, values: [\"H\",\"He\",\"Li\",\"Be\",\"B\"] }, \n",
       "{ name: \"<span title=\\\"Type: String\\\">Type</span>\", children: [], rightAlign: false, values: [\"Nonmetal\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Metalloid\"] }, \n",
       "{ name: \"<span title=\\\"Weight (ng): Double\\\">Weight (ng)</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.000000</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Radius: Double\\\">Radius</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.79</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.49</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.10</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.40</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.20</span></span>\"] }, \n",
       "], id: 503316480, rootId: 503316480, totalRows: 5 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(503316480) });\n",
       "\n",
       "document.getElementById(\"static_df_503316481\").style.display = \"none\";\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val df = DataFrame.readCSV(\"https://github.com/JetBrains/lets-plot-docs/\" +\n",
    "                           \"raw/refs/heads/master/data/chemical_elements.csv\").let { df ->\n",
    "    df[\"Element\", \"Symbol\", \"Type\", \"Atomic Weight\", \"Atomic Radius\"]\n",
    "        .rename(\"Element\", \"Atomic Weight\", \"Atomic Radius\")\n",
    "        .into(\"Name\", \"Weight (ng)\", \"Radius\")\n",
    "        .update { \"Weight (ng)\"<Double>() }.with { amuCoeffNG * it }\n",
    "}\n",
    "val dataMap = df.toMap()\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "240db094-b51d-4300-a4cb-52a255958db4",
   "metadata": {},
   "outputs": [],
   "source": [
    "val dMin = -7\n",
    "val dMax = 6\n",
    "val values = (dMin..dMax).map { d -> 10.0.pow(d) }\n",
    "\n",
    "fun hourglassPlot(title: String, numberFormat: String? = null): Plot {\n",
    "    return letsPlot() { y = values; label = values } +\n",
    "        geomText(labelFormat = numberFormat, size = 10) +\n",
    "        scaleYContinuous(limits = Pair(10.0.pow(dMin - 1), 10.0.pow(dMax + 1)),\n",
    "                         trans = \"log10\", format = numberFormat) +\n",
    "        ggtitle(title) +\n",
    "        themeClassic()\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "d257e73e-1e9c-4bc2-bf62-6a57aac5351b",
   "metadata": {},
   "outputs": [],
   "source": [
    "val chemicalElementsPlot = letsPlot(dataMap) +\n",
    "    geomLabel(alpha = .75, fontface = \"bold\") {\n",
    "        x = \"Weight (ng)\"; y = \"Radius\"; label = \"Symbol\"; fill = \"Type\"\n",
    "    } +\n",
    "    scaleFillBrewer(guide = guideLegend(ncol = 2)) +\n",
    "    ggsize(1000, 500) +\n",
    "    theme(axisTextX = elementText(size = 16, face = \"bold\"),\n",
    "          legendKeySize = 12, legendText = elementText(size = 9))\n",
    "        .legendPosition(.91, .82)\n",
    "\n",
    "fun formattedXScale(numberFormat: String? = null): Scale {\n",
    "    return scaleXContinuous(limits = Pair(0.0, 4 * 10.0.pow(-13)),\n",
    "                            breaks = (0..8).map { (it / 2.0) * 10.0.pow(-13) },\n",
    "                            format = numberFormat)\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f03ef3ad-f431-491f-a670-8021588bb983",
   "metadata": {},
   "source": [
    "## Default Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "9f9c3f05-27d5-40d6-841b-574cdb81aa60",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"cWlJNs\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   var containerDiv = document.getElementById(\"cWlJNs\");\n",
       "   var observer = new ResizeObserver(function(entries) {\n",
       "       for (let entry of entries) {\n",
       "           var width = containerDiv.clientWidth\n",
       "           if (entry.contentBoxSize && width > 0) {\n",
       "           \n",
       "               // Render plot\n",
       "               if (observer) {\n",
       "                   observer.disconnect();\n",
       "                   observer = null;\n",
       "               }\n",
       "\n",
       "               var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "\"Radius\":[0.79,0.49,2.1,1.4,1.2,0.91,0.75,0.65,0.57,0.51,2.2,1.7,1.8,1.5,1.2,1.1,0.97,0.88,2.8,2.2,2.1,2.0,1.9,1.9,1.8,1.7,1.7,1.6,1.6,1.5,1.8,1.5,1.3,1.2,1.1,1.0,3.0,2.5,2.3,2.2,2.1,2.0,2.0,1.9,1.8,1.8,1.8,1.7,2.0,1.7,1.5,1.4,1.3,1.2,3.3,2.8,2.7,2.7,2.7,2.6,2.6,2.6,2.6,2.5,2.5,2.5,2.5,2.5,2.4,2.4,2.3,2.2,2.1,2.0,2.0,1.9,1.9,1.8,1.8,1.8,2.1,1.8,1.6,1.5,1.4,1.3,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\n",
       "\"Type\":[\"Nonmetal\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Metalloid\",\"Nonmetal\",\"Nonmetal\",\"Nonmetal\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Metal\",\"Metalloid\",\"Nonmetal\",\"Nonmetal\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Metal\",\"Metalloid\",\"Metalloid\",\"Nonmetal\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Metal\",\"Metal\",\"Metalloid\",\"Metalloid\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Metal\",\"Metal\",\"Metal\",\"Metalloid\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",null,\"Transactinide\",null,\"Transactinide\",null,\"Noble Gas\"],\n",
       "\"Symbol\":[\"H\",\"He\",\"Li\",\"Be\",\"B\",\"C\",\"N\",\"O\",\"F\",\"Ne\",\"Na\",\"Mg\",\"Al\",\"Si\",\"P\",\"S\",\"Cl\",\"Ar\",\"K\",\"Ca\",\"Sc\",\"Ti\",\"V\",\"Cr\",\"Mn\",\"Fe\",\"Co\",\"Ni\",\"Cu\",\"Zn\",\"Ga\",\"Ge\",\"As\",\"Se\",\"Br\",\"Kr\",\"Rb\",\"Sr\",\"Y\",\"Zr\",\"Nb\",\"Mo\",\"Tc\",\"Ru\",\"Rh\",\"Pd\",\"Ag\",\"Cd\",\"In\",\"Sn\",\"Sb\",\"Te\",\"I\",\"Xe\",\"Cs\",\"Ba\",\"La\",\"Ce\",\"Pr\",\"Nd\",\"Pm\",\"Sm\",\"Eu\",\"Gd\",\"Tb\",\"Dy\",\"Ho\",\"Er\",\"Tm\",\"Yb\",\"Lu\",\"Hf\",\"Ta\",\"W\",\"Re\",\"Os\",\"Ir\",\"Pt\",\"Au\",\"Hg\",\"Tl\",\"Pb\",\"Bi\",\"Po\",\"At\",\"Rn\",\"Fr\",\"Ra\",\"Ac\",\"Th\",\"Pa\",\"U\",\"Np\",\"Pu\",\"Am\",\"Cm\",\"Bk\",\"Cf\",\"Es\",\"Fm\",\"Md\",\"No\",\"Lr\",\"Rf\",\"Db\",\"Sg\",\"Bh\",\"Hs\",\"Mt\",\"Ds\",\"Rg\",\"Cn\",\"Uut\",\"Uuq\",\"Uup\",\"Uuh\",\"Uus\",\"Uuo\"],\n",
       "\"Weight (ng)\":[1.6737248891880002E-15,6.646481525600401E-15,1.15258095282E-14,1.49650905007164E-14,1.79521001022E-14,1.994425018014E-14,2.3258688419340004E-14,2.6567646875880002E-14,3.154761224940864E-14,3.350920307394E-14,3.817543607816506E-14,4.0359429561000004E-14,4.4803929503151725E-14,4.6637101787100005E-14,5.1433176946232406E-14,5.3245221513E-14,5.887113171060001E-14,6.63352599096E-14,6.492429890166001E-14,6.65511301356E-14,7.465109910366241E-14,7.94850777534E-14,8.45904085983E-14,8.634161429322E-14,9.122683223190901E-14,9.2732867469E-14,9.7860939411939E-14,9.746275017468E-14,1.0552068754920001E-13,1.08566118276E-13,1.157778443646E-13,1.2062164012800002E-13,1.2441032864832E-13,1.31116254192E-13,1.326838041408E-13,1.3914994767960002E-13,1.4192271770556E-13,1.4549653232400002E-13,1.4763173794017001E-13,1.514811192048E-13,1.54274778826476E-13,1.59345437592E-13,1.6273293960000002E-13,1.67830798014E-13,1.7087871955110003E-13,1.76714688084E-13,1.7911948240164001E-13,1.8666298442220002E-13,1.906599046836E-13,1.97122727142E-13,2.0218737475200002E-13,2.1188492952E-13,2.1072997399469403E-13,2.1801730447860004E-13,2.206948456791164E-13,2.2803700404540003E-13,2.3065811693489404E-13,2.3266825066320004E-13,2.3398281731253E-13,2.395196395284E-13,2.4077832900000003E-13,2.4967882447200005E-13,2.523423309528E-13,2.6111994645000004E-13,2.6390193247407E-13,2.6983778250000003E-13,2.73873426558864E-13,2.777402933118E-13,2.8052204686024204E-13,2.873631237708E-13,2.9053940506536003E-13,2.96389820298E-13,3.00471228844776E-13,3.05273710368E-13,3.092042090214E-13,3.15884562246E-13,3.1918405562340006E-13,3.2394482437680003E-13,3.270709058805738E-13,3.3308775871800005E-13,3.3938668585866E-13,3.4406392944E-13,3.4702035521208005E-13,3.48713442E-13,3.48713442E-13,3.686399244E-13,3.7030046460000005E-13,3.752820852E-13,3.7694262540000005E-13,3.8530852656001206E-13,3.83644366382376E-13,3.9525657381718203E-13,3.935480274E-13,4.0517180880000003E-13,4.0351126860000004E-13,4.1015342940000004E-13,4.1015342940000004E-13,4.1679559020000004E-13,4.1845613040000003E-13,4.267588314E-13,4.2841937160000006E-13,4.3007991180000004E-13,4.3506153240000006E-13,4.334009922E-13,4.3506153240000006E-13,4.4170369320000006E-13,4.3838261280000003E-13,4.4336423340000004E-13,4.4502477360000003E-13,4.5000639420000004E-13,4.5166693440000003E-13,4.732539570000001E-13,4.715934168E-13,4.798961178E-13,4.782355776000001E-13,4.848777384E-13,4.89859359E-13,4.881988188E-13]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":1000.0,\n",
       "\"height\":500.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_brewer\",\n",
       "\"guide\":{\n",
       "\"name\":\"legend\",\n",
       "\"ncol\":2\n",
       "}\n",
       "},{\n",
       "\"aesthetic\":\"x\",\n",
       "\"breaks\":[0.0,5.0E-14,1.0E-13,1.5000000000000002E-13,2.0E-13,2.5E-13,3.0000000000000003E-13,3.5E-13,4.0E-13],\n",
       "\"limits\":[0.0,4.0E-13]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"x\":\"Weight (ng)\",\n",
       "\"y\":\"Radius\",\n",
       "\"label\":\"Symbol\",\n",
       "\"fill\":\"Type\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"alpha\":0.75,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"label\",\n",
       "\"fontface\":\"bold\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"legend_text\":{\n",
       "\"size\":9.0,\n",
       "\"blank\":false\n",
       "},\n",
       "\"axis_text_x\":{\n",
       "\"face\":\"bold\",\n",
       "\"size\":16.0,\n",
       "\"blank\":false\n",
       "},\n",
       "\"legend_key_size\":12.0,\n",
       "\"legend_position\":[0.91,0.82]\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"Name\"\n",
       "},{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"Symbol\"\n",
       "},{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"Type\"\n",
       "},{\n",
       "\"type\":\"float\",\n",
       "\"column\":\"Weight (ng)\"\n",
       "},{\n",
       "\"type\":\"float\",\n",
       "\"column\":\"Radius\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"1\"\n",
       "};\n",
       "               window.letsPlotCall(function() {\n",
       "       \n",
       "               var toolbar = null;\n",
       "               var plotContainer = containerDiv;               \n",
       "               \n",
       "                   var options = {\n",
       "                       sizing: {\n",
       "                           width_mode: \"min\",\n",
       "                           height_mode: \"scaled\",\n",
       "                           width: width\n",
       "                       }\n",
       "                   };\n",
       "                   var fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer, options);\n",
       "                   if (toolbar) {\n",
       "                     toolbar.bind(fig);\n",
       "                   }\n",
       "               });\n",
       "               \n",
       "               break;\n",
       "           }\n",
       "       }\n",
       "   });\n",
       "   \n",
       "   observer.observe(containerDiv);\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chemicalElementsPlot + formattedXScale()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "adda6e7e-dc7c-4681-b646-40a4e302f80c",
   "metadata": {},
   "source": [
    "## Specify Format"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "61623db3-3958-4f77-af18-72e8178b0fee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"MIEYwH\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   var containerDiv = document.getElementById(\"MIEYwH\");\n",
       "   var observer = new ResizeObserver(function(entries) {\n",
       "       for (let entry of entries) {\n",
       "           var width = containerDiv.clientWidth\n",
       "           if (entry.contentBoxSize && width > 0) {\n",
       "           \n",
       "               // Render plot\n",
       "               if (observer) {\n",
       "                   observer.disconnect();\n",
       "                   observer = null;\n",
       "               }\n",
       "\n",
       "               var plotSpec={\n",
       "\"layout\":{\n",
       "\"name\":\"grid\",\n",
       "\"ncol\":2,\n",
       "\"nrow\":1,\n",
       "\"fit\":true,\n",
       "\"align\":false\n",
       "},\n",
       "\"figures\":[{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"Default format\"\n",
       "},\n",
       "\"mapping\":{\n",
       "\"y\":\"y\",\n",
       "\"label\":\"label\"\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"y\",\n",
       "\"limits\":[1.0E-8,1.0E7],\n",
       "\"trans\":\"log10\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":10.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"text\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\"\n",
       "},\n",
       "\"data\":{\n",
       "\"y\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0],\n",
       "\"label\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0]\n",
       "},\n",
       "\"spec_id\":\"2\"\n",
       "},{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"format='g'\"\n",
       "},\n",
       "\"mapping\":{\n",
       "\"y\":\"y\",\n",
       "\"label\":\"label\"\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"y\",\n",
       "\"format\":\"g\",\n",
       "\"limits\":[1.0E-8,1.0E7],\n",
       "\"trans\":\"log10\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":10.0,\n",
       "\"label_format\":\"g\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"text\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\"\n",
       "},\n",
       "\"data\":{\n",
       "\"y\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0],\n",
       "\"label\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0]\n",
       "},\n",
       "\"spec_id\":\"3\"\n",
       "}],\n",
       "\"kind\":\"subplots\"\n",
       "};\n",
       "               window.letsPlotCall(function() {\n",
       "       \n",
       "               var toolbar = null;\n",
       "               var plotContainer = containerDiv;               \n",
       "               \n",
       "                   var options = {\n",
       "                       sizing: {\n",
       "                           width_mode: \"min\",\n",
       "                           height_mode: \"scaled\",\n",
       "                           width: width\n",
       "                       }\n",
       "                   };\n",
       "                   var fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer, options);\n",
       "                   if (toolbar) {\n",
       "                     toolbar.bind(fig);\n",
       "                   }\n",
       "               });\n",
       "               \n",
       "               break;\n",
       "           }\n",
       "       }\n",
       "   });\n",
       "   \n",
       "   observer.observe(containerDiv);\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gggrid(listOf(\n",
    "    hourglassPlot(\"Default format\"),\n",
    "    hourglassPlot(\"format='g'\", \"g\")\n",
    "))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "2850ec12-c6e4-4ae5-b76d-cf16b0e862ab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"Pltlhl\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   var containerDiv = document.getElementById(\"Pltlhl\");\n",
       "   var observer = new ResizeObserver(function(entries) {\n",
       "       for (let entry of entries) {\n",
       "           var width = containerDiv.clientWidth\n",
       "           if (entry.contentBoxSize && width > 0) {\n",
       "           \n",
       "               // Render plot\n",
       "               if (observer) {\n",
       "                   observer.disconnect();\n",
       "                   observer = null;\n",
       "               }\n",
       "\n",
       "               var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "\"Radius\":[0.79,0.49,2.1,1.4,1.2,0.91,0.75,0.65,0.57,0.51,2.2,1.7,1.8,1.5,1.2,1.1,0.97,0.88,2.8,2.2,2.1,2.0,1.9,1.9,1.8,1.7,1.7,1.6,1.6,1.5,1.8,1.5,1.3,1.2,1.1,1.0,3.0,2.5,2.3,2.2,2.1,2.0,2.0,1.9,1.8,1.8,1.8,1.7,2.0,1.7,1.5,1.4,1.3,1.2,3.3,2.8,2.7,2.7,2.7,2.6,2.6,2.6,2.6,2.5,2.5,2.5,2.5,2.5,2.4,2.4,2.3,2.2,2.1,2.0,2.0,1.9,1.9,1.8,1.8,1.8,2.1,1.8,1.6,1.5,1.4,1.3,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\n",
       "\"Type\":[\"Nonmetal\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Metalloid\",\"Nonmetal\",\"Nonmetal\",\"Nonmetal\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Metal\",\"Metalloid\",\"Nonmetal\",\"Nonmetal\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Metal\",\"Metalloid\",\"Metalloid\",\"Nonmetal\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Metal\",\"Metal\",\"Metalloid\",\"Metalloid\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Metal\",\"Metal\",\"Metal\",\"Metalloid\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",null,\"Transactinide\",null,\"Transactinide\",null,\"Noble Gas\"],\n",
       "\"Symbol\":[\"H\",\"He\",\"Li\",\"Be\",\"B\",\"C\",\"N\",\"O\",\"F\",\"Ne\",\"Na\",\"Mg\",\"Al\",\"Si\",\"P\",\"S\",\"Cl\",\"Ar\",\"K\",\"Ca\",\"Sc\",\"Ti\",\"V\",\"Cr\",\"Mn\",\"Fe\",\"Co\",\"Ni\",\"Cu\",\"Zn\",\"Ga\",\"Ge\",\"As\",\"Se\",\"Br\",\"Kr\",\"Rb\",\"Sr\",\"Y\",\"Zr\",\"Nb\",\"Mo\",\"Tc\",\"Ru\",\"Rh\",\"Pd\",\"Ag\",\"Cd\",\"In\",\"Sn\",\"Sb\",\"Te\",\"I\",\"Xe\",\"Cs\",\"Ba\",\"La\",\"Ce\",\"Pr\",\"Nd\",\"Pm\",\"Sm\",\"Eu\",\"Gd\",\"Tb\",\"Dy\",\"Ho\",\"Er\",\"Tm\",\"Yb\",\"Lu\",\"Hf\",\"Ta\",\"W\",\"Re\",\"Os\",\"Ir\",\"Pt\",\"Au\",\"Hg\",\"Tl\",\"Pb\",\"Bi\",\"Po\",\"At\",\"Rn\",\"Fr\",\"Ra\",\"Ac\",\"Th\",\"Pa\",\"U\",\"Np\",\"Pu\",\"Am\",\"Cm\",\"Bk\",\"Cf\",\"Es\",\"Fm\",\"Md\",\"No\",\"Lr\",\"Rf\",\"Db\",\"Sg\",\"Bh\",\"Hs\",\"Mt\",\"Ds\",\"Rg\",\"Cn\",\"Uut\",\"Uuq\",\"Uup\",\"Uuh\",\"Uus\",\"Uuo\"],\n",
       "\"Weight (ng)\":[1.6737248891880002E-15,6.646481525600401E-15,1.15258095282E-14,1.49650905007164E-14,1.79521001022E-14,1.994425018014E-14,2.3258688419340004E-14,2.6567646875880002E-14,3.154761224940864E-14,3.350920307394E-14,3.817543607816506E-14,4.0359429561000004E-14,4.4803929503151725E-14,4.6637101787100005E-14,5.1433176946232406E-14,5.3245221513E-14,5.887113171060001E-14,6.63352599096E-14,6.492429890166001E-14,6.65511301356E-14,7.465109910366241E-14,7.94850777534E-14,8.45904085983E-14,8.634161429322E-14,9.122683223190901E-14,9.2732867469E-14,9.7860939411939E-14,9.746275017468E-14,1.0552068754920001E-13,1.08566118276E-13,1.157778443646E-13,1.2062164012800002E-13,1.2441032864832E-13,1.31116254192E-13,1.326838041408E-13,1.3914994767960002E-13,1.4192271770556E-13,1.4549653232400002E-13,1.4763173794017001E-13,1.514811192048E-13,1.54274778826476E-13,1.59345437592E-13,1.6273293960000002E-13,1.67830798014E-13,1.7087871955110003E-13,1.76714688084E-13,1.7911948240164001E-13,1.8666298442220002E-13,1.906599046836E-13,1.97122727142E-13,2.0218737475200002E-13,2.1188492952E-13,2.1072997399469403E-13,2.1801730447860004E-13,2.206948456791164E-13,2.2803700404540003E-13,2.3065811693489404E-13,2.3266825066320004E-13,2.3398281731253E-13,2.395196395284E-13,2.4077832900000003E-13,2.4967882447200005E-13,2.523423309528E-13,2.6111994645000004E-13,2.6390193247407E-13,2.6983778250000003E-13,2.73873426558864E-13,2.777402933118E-13,2.8052204686024204E-13,2.873631237708E-13,2.9053940506536003E-13,2.96389820298E-13,3.00471228844776E-13,3.05273710368E-13,3.092042090214E-13,3.15884562246E-13,3.1918405562340006E-13,3.2394482437680003E-13,3.270709058805738E-13,3.3308775871800005E-13,3.3938668585866E-13,3.4406392944E-13,3.4702035521208005E-13,3.48713442E-13,3.48713442E-13,3.686399244E-13,3.7030046460000005E-13,3.752820852E-13,3.7694262540000005E-13,3.8530852656001206E-13,3.83644366382376E-13,3.9525657381718203E-13,3.935480274E-13,4.0517180880000003E-13,4.0351126860000004E-13,4.1015342940000004E-13,4.1015342940000004E-13,4.1679559020000004E-13,4.1845613040000003E-13,4.267588314E-13,4.2841937160000006E-13,4.3007991180000004E-13,4.3506153240000006E-13,4.334009922E-13,4.3506153240000006E-13,4.4170369320000006E-13,4.3838261280000003E-13,4.4336423340000004E-13,4.4502477360000003E-13,4.5000639420000004E-13,4.5166693440000003E-13,4.732539570000001E-13,4.715934168E-13,4.798961178E-13,4.782355776000001E-13,4.848777384E-13,4.89859359E-13,4.881988188E-13]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":1000.0,\n",
       "\"height\":500.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_brewer\",\n",
       "\"guide\":{\n",
       "\"name\":\"legend\",\n",
       "\"ncol\":2\n",
       "}\n",
       "},{\n",
       "\"aesthetic\":\"x\",\n",
       "\"breaks\":[0.0,5.0E-14,1.0E-13,1.5000000000000002E-13,2.0E-13,2.5E-13,3.0000000000000003E-13,3.5E-13,4.0E-13],\n",
       "\"format\":\"g\",\n",
       "\"limits\":[0.0,4.0E-13]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"x\":\"Weight (ng)\",\n",
       "\"y\":\"Radius\",\n",
       "\"label\":\"Symbol\",\n",
       "\"fill\":\"Type\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"alpha\":0.75,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"label\",\n",
       "\"fontface\":\"bold\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"legend_text\":{\n",
       "\"size\":9.0,\n",
       "\"blank\":false\n",
       "},\n",
       "\"axis_text_x\":{\n",
       "\"face\":\"bold\",\n",
       "\"size\":16.0,\n",
       "\"blank\":false\n",
       "},\n",
       "\"legend_key_size\":12.0,\n",
       "\"legend_position\":[0.91,0.82]\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"Name\"\n",
       "},{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"Symbol\"\n",
       "},{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"Type\"\n",
       "},{\n",
       "\"type\":\"float\",\n",
       "\"column\":\"Weight (ng)\"\n",
       "},{\n",
       "\"type\":\"float\",\n",
       "\"column\":\"Radius\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"4\"\n",
       "};\n",
       "               window.letsPlotCall(function() {\n",
       "       \n",
       "               var toolbar = null;\n",
       "               var plotContainer = containerDiv;               \n",
       "               \n",
       "                   var options = {\n",
       "                       sizing: {\n",
       "                           width_mode: \"min\",\n",
       "                           height_mode: \"scaled\",\n",
       "                           width: width\n",
       "                       }\n",
       "                   };\n",
       "                   var fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer, options);\n",
       "                   if (toolbar) {\n",
       "                     toolbar.bind(fig);\n",
       "                   }\n",
       "               });\n",
       "               \n",
       "               break;\n",
       "           }\n",
       "       }\n",
       "   });\n",
       "   \n",
       "   observer.observe(containerDiv);\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chemicalElementsPlot + formattedXScale(\"g\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5461e7c5-ebc5-4d5b-8c38-64a4c13f209d",
   "metadata": {},
   "source": [
    "## Switch Exponent Format to Power Degree"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "ff0d73d8-2799-48a0-830f-5af87e7368dd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"3HS9FW\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   var containerDiv = document.getElementById(\"3HS9FW\");\n",
       "   var observer = new ResizeObserver(function(entries) {\n",
       "       for (let entry of entries) {\n",
       "           var width = containerDiv.clientWidth\n",
       "           if (entry.contentBoxSize && width > 0) {\n",
       "           \n",
       "               // Render plot\n",
       "               if (observer) {\n",
       "                   observer.disconnect();\n",
       "                   observer = null;\n",
       "               }\n",
       "\n",
       "               var plotSpec={\n",
       "\"layout\":{\n",
       "\"name\":\"grid\",\n",
       "\"ncol\":3,\n",
       "\"nrow\":1,\n",
       "\"fit\":true,\n",
       "\"align\":false\n",
       "},\n",
       "\"figures\":[{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"Default exponentFormat\"\n",
       "},\n",
       "\"mapping\":{\n",
       "\"y\":\"y\",\n",
       "\"label\":\"label\"\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"y\",\n",
       "\"format\":\"g\",\n",
       "\"limits\":[1.0E-8,1.0E7],\n",
       "\"trans\":\"log10\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":10.0,\n",
       "\"label_format\":\"g\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"text\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\"\n",
       "},\n",
       "\"data\":{\n",
       "\"y\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0],\n",
       "\"label\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0]\n",
       "},\n",
       "\"spec_id\":\"5\"\n",
       "},{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"exponentFormat='pow'\"\n",
       "},\n",
       "\"mapping\":{\n",
       "\"y\":\"y\",\n",
       "\"label\":\"label\"\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"y\",\n",
       "\"format\":\"g\",\n",
       "\"limits\":[1.0E-8,1.0E7],\n",
       "\"trans\":\"log10\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":10.0,\n",
       "\"label_format\":\"g\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"text\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"exponent_format\":\"pow\"\n",
       "},\n",
       "\"data\":{\n",
       "\"y\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0],\n",
       "\"label\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0]\n",
       "},\n",
       "\"spec_id\":\"6\"\n",
       "},{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"exponentFormat='pow_full'\"\n",
       "},\n",
       "\"mapping\":{\n",
       "\"y\":\"y\",\n",
       "\"label\":\"label\"\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"y\",\n",
       "\"format\":\"g\",\n",
       "\"limits\":[1.0E-8,1.0E7],\n",
       "\"trans\":\"log10\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":10.0,\n",
       "\"label_format\":\"g\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"text\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"exponent_format\":\"pow_full\"\n",
       "},\n",
       "\"data\":{\n",
       "\"y\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0],\n",
       "\"label\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0]\n",
       "},\n",
       "\"spec_id\":\"7\"\n",
       "}],\n",
       "\"kind\":\"subplots\"\n",
       "};\n",
       "               window.letsPlotCall(function() {\n",
       "       \n",
       "               var toolbar = null;\n",
       "               var plotContainer = containerDiv;               \n",
       "               \n",
       "                   var options = {\n",
       "                       sizing: {\n",
       "                           width_mode: \"min\",\n",
       "                           height_mode: \"scaled\",\n",
       "                           width: width\n",
       "                       }\n",
       "                   };\n",
       "                   var fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer, options);\n",
       "                   if (toolbar) {\n",
       "                     toolbar.bind(fig);\n",
       "                   }\n",
       "               });\n",
       "               \n",
       "               break;\n",
       "           }\n",
       "       }\n",
       "   });\n",
       "   \n",
       "   observer.observe(containerDiv);\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gggrid(listOf(\n",
    "    hourglassPlot(\"Default exponentFormat\", \"g\"),\n",
    "    hourglassPlot(\"exponentFormat='pow'\", \"g\") + theme(exponentFormat = \"pow\"),\n",
    "    hourglassPlot(\"exponentFormat='pow_full'\", \"g\") + theme(exponentFormat = \"pow_full\")\n",
    "))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "34d78675-426f-4707-9049-da62f0913783",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"j2z31C\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   var containerDiv = document.getElementById(\"j2z31C\");\n",
       "   var observer = new ResizeObserver(function(entries) {\n",
       "       for (let entry of entries) {\n",
       "           var width = containerDiv.clientWidth\n",
       "           if (entry.contentBoxSize && width > 0) {\n",
       "           \n",
       "               // Render plot\n",
       "               if (observer) {\n",
       "                   observer.disconnect();\n",
       "                   observer = null;\n",
       "               }\n",
       "\n",
       "               var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "\"Radius\":[0.79,0.49,2.1,1.4,1.2,0.91,0.75,0.65,0.57,0.51,2.2,1.7,1.8,1.5,1.2,1.1,0.97,0.88,2.8,2.2,2.1,2.0,1.9,1.9,1.8,1.7,1.7,1.6,1.6,1.5,1.8,1.5,1.3,1.2,1.1,1.0,3.0,2.5,2.3,2.2,2.1,2.0,2.0,1.9,1.8,1.8,1.8,1.7,2.0,1.7,1.5,1.4,1.3,1.2,3.3,2.8,2.7,2.7,2.7,2.6,2.6,2.6,2.6,2.5,2.5,2.5,2.5,2.5,2.4,2.4,2.3,2.2,2.1,2.0,2.0,1.9,1.9,1.8,1.8,1.8,2.1,1.8,1.6,1.5,1.4,1.3,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\n",
       "\"Type\":[\"Nonmetal\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Metalloid\",\"Nonmetal\",\"Nonmetal\",\"Nonmetal\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Metal\",\"Metalloid\",\"Nonmetal\",\"Nonmetal\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Metal\",\"Metalloid\",\"Metalloid\",\"Nonmetal\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Metal\",\"Metal\",\"Metalloid\",\"Metalloid\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Metal\",\"Metal\",\"Metal\",\"Metalloid\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",null,\"Transactinide\",null,\"Transactinide\",null,\"Noble Gas\"],\n",
       "\"Symbol\":[\"H\",\"He\",\"Li\",\"Be\",\"B\",\"C\",\"N\",\"O\",\"F\",\"Ne\",\"Na\",\"Mg\",\"Al\",\"Si\",\"P\",\"S\",\"Cl\",\"Ar\",\"K\",\"Ca\",\"Sc\",\"Ti\",\"V\",\"Cr\",\"Mn\",\"Fe\",\"Co\",\"Ni\",\"Cu\",\"Zn\",\"Ga\",\"Ge\",\"As\",\"Se\",\"Br\",\"Kr\",\"Rb\",\"Sr\",\"Y\",\"Zr\",\"Nb\",\"Mo\",\"Tc\",\"Ru\",\"Rh\",\"Pd\",\"Ag\",\"Cd\",\"In\",\"Sn\",\"Sb\",\"Te\",\"I\",\"Xe\",\"Cs\",\"Ba\",\"La\",\"Ce\",\"Pr\",\"Nd\",\"Pm\",\"Sm\",\"Eu\",\"Gd\",\"Tb\",\"Dy\",\"Ho\",\"Er\",\"Tm\",\"Yb\",\"Lu\",\"Hf\",\"Ta\",\"W\",\"Re\",\"Os\",\"Ir\",\"Pt\",\"Au\",\"Hg\",\"Tl\",\"Pb\",\"Bi\",\"Po\",\"At\",\"Rn\",\"Fr\",\"Ra\",\"Ac\",\"Th\",\"Pa\",\"U\",\"Np\",\"Pu\",\"Am\",\"Cm\",\"Bk\",\"Cf\",\"Es\",\"Fm\",\"Md\",\"No\",\"Lr\",\"Rf\",\"Db\",\"Sg\",\"Bh\",\"Hs\",\"Mt\",\"Ds\",\"Rg\",\"Cn\",\"Uut\",\"Uuq\",\"Uup\",\"Uuh\",\"Uus\",\"Uuo\"],\n",
       "\"Weight (ng)\":[1.6737248891880002E-15,6.646481525600401E-15,1.15258095282E-14,1.49650905007164E-14,1.79521001022E-14,1.994425018014E-14,2.3258688419340004E-14,2.6567646875880002E-14,3.154761224940864E-14,3.350920307394E-14,3.817543607816506E-14,4.0359429561000004E-14,4.4803929503151725E-14,4.6637101787100005E-14,5.1433176946232406E-14,5.3245221513E-14,5.887113171060001E-14,6.63352599096E-14,6.492429890166001E-14,6.65511301356E-14,7.465109910366241E-14,7.94850777534E-14,8.45904085983E-14,8.634161429322E-14,9.122683223190901E-14,9.2732867469E-14,9.7860939411939E-14,9.746275017468E-14,1.0552068754920001E-13,1.08566118276E-13,1.157778443646E-13,1.2062164012800002E-13,1.2441032864832E-13,1.31116254192E-13,1.326838041408E-13,1.3914994767960002E-13,1.4192271770556E-13,1.4549653232400002E-13,1.4763173794017001E-13,1.514811192048E-13,1.54274778826476E-13,1.59345437592E-13,1.6273293960000002E-13,1.67830798014E-13,1.7087871955110003E-13,1.76714688084E-13,1.7911948240164001E-13,1.8666298442220002E-13,1.906599046836E-13,1.97122727142E-13,2.0218737475200002E-13,2.1188492952E-13,2.1072997399469403E-13,2.1801730447860004E-13,2.206948456791164E-13,2.2803700404540003E-13,2.3065811693489404E-13,2.3266825066320004E-13,2.3398281731253E-13,2.395196395284E-13,2.4077832900000003E-13,2.4967882447200005E-13,2.523423309528E-13,2.6111994645000004E-13,2.6390193247407E-13,2.6983778250000003E-13,2.73873426558864E-13,2.777402933118E-13,2.8052204686024204E-13,2.873631237708E-13,2.9053940506536003E-13,2.96389820298E-13,3.00471228844776E-13,3.05273710368E-13,3.092042090214E-13,3.15884562246E-13,3.1918405562340006E-13,3.2394482437680003E-13,3.270709058805738E-13,3.3308775871800005E-13,3.3938668585866E-13,3.4406392944E-13,3.4702035521208005E-13,3.48713442E-13,3.48713442E-13,3.686399244E-13,3.7030046460000005E-13,3.752820852E-13,3.7694262540000005E-13,3.8530852656001206E-13,3.83644366382376E-13,3.9525657381718203E-13,3.935480274E-13,4.0517180880000003E-13,4.0351126860000004E-13,4.1015342940000004E-13,4.1015342940000004E-13,4.1679559020000004E-13,4.1845613040000003E-13,4.267588314E-13,4.2841937160000006E-13,4.3007991180000004E-13,4.3506153240000006E-13,4.334009922E-13,4.3506153240000006E-13,4.4170369320000006E-13,4.3838261280000003E-13,4.4336423340000004E-13,4.4502477360000003E-13,4.5000639420000004E-13,4.5166693440000003E-13,4.732539570000001E-13,4.715934168E-13,4.798961178E-13,4.782355776000001E-13,4.848777384E-13,4.89859359E-13,4.881988188E-13]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":1000.0,\n",
       "\"height\":500.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_brewer\",\n",
       "\"guide\":{\n",
       "\"name\":\"legend\",\n",
       "\"ncol\":2\n",
       "}\n",
       "},{\n",
       "\"aesthetic\":\"x\",\n",
       "\"breaks\":[0.0,5.0E-14,1.0E-13,1.5000000000000002E-13,2.0E-13,2.5E-13,3.0000000000000003E-13,3.5E-13,4.0E-13],\n",
       "\"format\":\"g\",\n",
       "\"limits\":[0.0,4.0E-13]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"x\":\"Weight (ng)\",\n",
       "\"y\":\"Radius\",\n",
       "\"label\":\"Symbol\",\n",
       "\"fill\":\"Type\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"alpha\":0.75,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"label\",\n",
       "\"fontface\":\"bold\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"legend_text\":{\n",
       "\"size\":9.0,\n",
       "\"blank\":false\n",
       "},\n",
       "\"axis_text_x\":{\n",
       "\"face\":\"bold\",\n",
       "\"size\":16.0,\n",
       "\"blank\":false\n",
       "},\n",
       "\"legend_key_size\":12.0,\n",
       "\"legend_position\":[0.91,0.82],\n",
       "\"exponent_format\":\"pow\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"Name\"\n",
       "},{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"Symbol\"\n",
       "},{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"Type\"\n",
       "},{\n",
       "\"type\":\"float\",\n",
       "\"column\":\"Weight (ng)\"\n",
       "},{\n",
       "\"type\":\"float\",\n",
       "\"column\":\"Radius\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"8\"\n",
       "};\n",
       "               window.letsPlotCall(function() {\n",
       "       \n",
       "               var toolbar = null;\n",
       "               var plotContainer = containerDiv;               \n",
       "               \n",
       "                   var options = {\n",
       "                       sizing: {\n",
       "                           width_mode: \"min\",\n",
       "                           height_mode: \"scaled\",\n",
       "                           width: width\n",
       "                       }\n",
       "                   };\n",
       "                   var fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer, options);\n",
       "                   if (toolbar) {\n",
       "                     toolbar.bind(fig);\n",
       "                   }\n",
       "               });\n",
       "               \n",
       "               break;\n",
       "           }\n",
       "       }\n",
       "   });\n",
       "   \n",
       "   observer.observe(containerDiv);\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chemicalElementsPlot + formattedXScale(\"g\") + theme(exponentFormat = \"pow\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "706607dc-9062-4345-a606-c9293fbb0a99",
   "metadata": {},
   "source": [
    "## Specify the Limits From Which the Scientific Notation Used"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "32fa3069-b6ee-4fcd-b71b-65ae9d79e802",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"681Bk9\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   var containerDiv = document.getElementById(\"681Bk9\");\n",
       "   var observer = new ResizeObserver(function(entries) {\n",
       "       for (let entry of entries) {\n",
       "           var width = containerDiv.clientWidth\n",
       "           if (entry.contentBoxSize && width > 0) {\n",
       "           \n",
       "               // Render plot\n",
       "               if (observer) {\n",
       "                   observer.disconnect();\n",
       "                   observer = null;\n",
       "               }\n",
       "\n",
       "               var plotSpec={\n",
       "\"layout\":{\n",
       "\"name\":\"grid\",\n",
       "\"ncol\":2,\n",
       "\"nrow\":1,\n",
       "\"fit\":true,\n",
       "\"align\":false\n",
       "},\n",
       "\"figures\":[{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"Default limits\"\n",
       "},\n",
       "\"mapping\":{\n",
       "\"y\":\"y\",\n",
       "\"label\":\"label\"\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"y\",\n",
       "\"format\":\"g\",\n",
       "\"limits\":[1.0E-8,1.0E7],\n",
       "\"trans\":\"log10\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":10.0,\n",
       "\"label_format\":\"g\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"text\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"exponent_format\":\"pow\"\n",
       "},\n",
       "\"data\":{\n",
       "\"y\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0],\n",
       "\"label\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0]\n",
       "},\n",
       "\"spec_id\":\"9\"\n",
       "},{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"Scientific notation for \\\\( x \\\\leq 10^{-3} \\\\) and \\\\( x \\\\geq 10^3 \\\\)\"\n",
       "},\n",
       "\"mapping\":{\n",
       "\"y\":\"y\",\n",
       "\"label\":\"label\"\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"y\",\n",
       "\"format\":\"g\",\n",
       "\"limits\":[1.0E-8,1.0E7],\n",
       "\"trans\":\"log10\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":10.0,\n",
       "\"label_format\":\"g\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"text\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"exponent_format\":[\"pow\",-3.0,3.0]\n",
       "},\n",
       "\"data\":{\n",
       "\"y\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0],\n",
       "\"label\":[1.0E-7,1.0E-6,9.999999999999999E-6,1.0E-4,0.001,0.01,0.1,1.0,10.0,100.0,1000.0,10000.0,100000.0,1000000.0]\n",
       "},\n",
       "\"spec_id\":\"10\"\n",
       "}],\n",
       "\"kind\":\"subplots\"\n",
       "};\n",
       "               window.letsPlotCall(function() {\n",
       "       \n",
       "               var toolbar = null;\n",
       "               var plotContainer = containerDiv;               \n",
       "               \n",
       "                   var options = {\n",
       "                       sizing: {\n",
       "                           width_mode: \"min\",\n",
       "                           height_mode: \"scaled\",\n",
       "                           width: width\n",
       "                       }\n",
       "                   };\n",
       "                   var fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer, options);\n",
       "                   if (toolbar) {\n",
       "                     toolbar.bind(fig);\n",
       "                   }\n",
       "               });\n",
       "               \n",
       "               break;\n",
       "           }\n",
       "       }\n",
       "   });\n",
       "   \n",
       "   observer.observe(containerDiv);\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gggrid(listOf(\n",
    "    hourglassPlot(\"Default limits\", \"g\") + theme(exponentFormat = \"pow\"),\n",
    "    hourglassPlot(\"\"\"Scientific notation for \\( x \\leq 10^{-3} \\) and \\( x \\geq 10^3 \\)\"\"\", \"g\") +\n",
    "        theme(exponentFormat = listOf(\"pow\", -3, 3))\n",
    "))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "20f575f2-a925-40ab-9eb1-c6b53ebc31a1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"dGtGZ7\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   var containerDiv = document.getElementById(\"dGtGZ7\");\n",
       "   var observer = new ResizeObserver(function(entries) {\n",
       "       for (let entry of entries) {\n",
       "           var width = containerDiv.clientWidth\n",
       "           if (entry.contentBoxSize && width > 0) {\n",
       "           \n",
       "               // Render plot\n",
       "               if (observer) {\n",
       "                   observer.disconnect();\n",
       "                   observer = null;\n",
       "               }\n",
       "\n",
       "               var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "\"Radius\":[0.79,0.49,2.1,1.4,1.2,0.91,0.75,0.65,0.57,0.51,2.2,1.7,1.8,1.5,1.2,1.1,0.97,0.88,2.8,2.2,2.1,2.0,1.9,1.9,1.8,1.7,1.7,1.6,1.6,1.5,1.8,1.5,1.3,1.2,1.1,1.0,3.0,2.5,2.3,2.2,2.1,2.0,2.0,1.9,1.8,1.8,1.8,1.7,2.0,1.7,1.5,1.4,1.3,1.2,3.3,2.8,2.7,2.7,2.7,2.6,2.6,2.6,2.6,2.5,2.5,2.5,2.5,2.5,2.4,2.4,2.3,2.2,2.1,2.0,2.0,1.9,1.9,1.8,1.8,1.8,2.1,1.8,1.6,1.5,1.4,1.3,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\n",
       "\"Type\":[\"Nonmetal\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Metalloid\",\"Nonmetal\",\"Nonmetal\",\"Nonmetal\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Metal\",\"Metalloid\",\"Nonmetal\",\"Nonmetal\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Metal\",\"Metalloid\",\"Metalloid\",\"Nonmetal\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Metal\",\"Metal\",\"Metalloid\",\"Metalloid\",\"Halogen\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Lanthanide\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Transition Metal\",\"Metal\",\"Metal\",\"Metal\",\"Metalloid\",\"Noble Gas\",\"Alkali Metal\",\"Alkaline Earth Metal\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Actinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",\"Transactinide\",null,\"Transactinide\",null,\"Transactinide\",null,\"Noble Gas\"],\n",
       "\"Symbol\":[\"H\",\"He\",\"Li\",\"Be\",\"B\",\"C\",\"N\",\"O\",\"F\",\"Ne\",\"Na\",\"Mg\",\"Al\",\"Si\",\"P\",\"S\",\"Cl\",\"Ar\",\"K\",\"Ca\",\"Sc\",\"Ti\",\"V\",\"Cr\",\"Mn\",\"Fe\",\"Co\",\"Ni\",\"Cu\",\"Zn\",\"Ga\",\"Ge\",\"As\",\"Se\",\"Br\",\"Kr\",\"Rb\",\"Sr\",\"Y\",\"Zr\",\"Nb\",\"Mo\",\"Tc\",\"Ru\",\"Rh\",\"Pd\",\"Ag\",\"Cd\",\"In\",\"Sn\",\"Sb\",\"Te\",\"I\",\"Xe\",\"Cs\",\"Ba\",\"La\",\"Ce\",\"Pr\",\"Nd\",\"Pm\",\"Sm\",\"Eu\",\"Gd\",\"Tb\",\"Dy\",\"Ho\",\"Er\",\"Tm\",\"Yb\",\"Lu\",\"Hf\",\"Ta\",\"W\",\"Re\",\"Os\",\"Ir\",\"Pt\",\"Au\",\"Hg\",\"Tl\",\"Pb\",\"Bi\",\"Po\",\"At\",\"Rn\",\"Fr\",\"Ra\",\"Ac\",\"Th\",\"Pa\",\"U\",\"Np\",\"Pu\",\"Am\",\"Cm\",\"Bk\",\"Cf\",\"Es\",\"Fm\",\"Md\",\"No\",\"Lr\",\"Rf\",\"Db\",\"Sg\",\"Bh\",\"Hs\",\"Mt\",\"Ds\",\"Rg\",\"Cn\",\"Uut\",\"Uuq\",\"Uup\",\"Uuh\",\"Uus\",\"Uuo\"],\n",
       "\"Weight (ng)\":[1.6737248891880002E-15,6.646481525600401E-15,1.15258095282E-14,1.49650905007164E-14,1.79521001022E-14,1.994425018014E-14,2.3258688419340004E-14,2.6567646875880002E-14,3.154761224940864E-14,3.350920307394E-14,3.817543607816506E-14,4.0359429561000004E-14,4.4803929503151725E-14,4.6637101787100005E-14,5.1433176946232406E-14,5.3245221513E-14,5.887113171060001E-14,6.63352599096E-14,6.492429890166001E-14,6.65511301356E-14,7.465109910366241E-14,7.94850777534E-14,8.45904085983E-14,8.634161429322E-14,9.122683223190901E-14,9.2732867469E-14,9.7860939411939E-14,9.746275017468E-14,1.0552068754920001E-13,1.08566118276E-13,1.157778443646E-13,1.2062164012800002E-13,1.2441032864832E-13,1.31116254192E-13,1.326838041408E-13,1.3914994767960002E-13,1.4192271770556E-13,1.4549653232400002E-13,1.4763173794017001E-13,1.514811192048E-13,1.54274778826476E-13,1.59345437592E-13,1.6273293960000002E-13,1.67830798014E-13,1.7087871955110003E-13,1.76714688084E-13,1.7911948240164001E-13,1.8666298442220002E-13,1.906599046836E-13,1.97122727142E-13,2.0218737475200002E-13,2.1188492952E-13,2.1072997399469403E-13,2.1801730447860004E-13,2.206948456791164E-13,2.2803700404540003E-13,2.3065811693489404E-13,2.3266825066320004E-13,2.3398281731253E-13,2.395196395284E-13,2.4077832900000003E-13,2.4967882447200005E-13,2.523423309528E-13,2.6111994645000004E-13,2.6390193247407E-13,2.6983778250000003E-13,2.73873426558864E-13,2.777402933118E-13,2.8052204686024204E-13,2.873631237708E-13,2.9053940506536003E-13,2.96389820298E-13,3.00471228844776E-13,3.05273710368E-13,3.092042090214E-13,3.15884562246E-13,3.1918405562340006E-13,3.2394482437680003E-13,3.270709058805738E-13,3.3308775871800005E-13,3.3938668585866E-13,3.4406392944E-13,3.4702035521208005E-13,3.48713442E-13,3.48713442E-13,3.686399244E-13,3.7030046460000005E-13,3.752820852E-13,3.7694262540000005E-13,3.8530852656001206E-13,3.83644366382376E-13,3.9525657381718203E-13,3.935480274E-13,4.0517180880000003E-13,4.0351126860000004E-13,4.1015342940000004E-13,4.1015342940000004E-13,4.1679559020000004E-13,4.1845613040000003E-13,4.267588314E-13,4.2841937160000006E-13,4.3007991180000004E-13,4.3506153240000006E-13,4.334009922E-13,4.3506153240000006E-13,4.4170369320000006E-13,4.3838261280000003E-13,4.4336423340000004E-13,4.4502477360000003E-13,4.5000639420000004E-13,4.5166693440000003E-13,4.732539570000001E-13,4.715934168E-13,4.798961178E-13,4.782355776000001E-13,4.848777384E-13,4.89859359E-13,4.881988188E-13]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":1000.0,\n",
       "\"height\":500.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_brewer\",\n",
       "\"guide\":{\n",
       "\"name\":\"legend\",\n",
       "\"ncol\":2\n",
       "}\n",
       "},{\n",
       "\"aesthetic\":\"x\",\n",
       "\"breaks\":[0.0,5.0E-14,1.0E-13,1.5000000000000002E-13,2.0E-13,2.5E-13,3.0000000000000003E-13,3.5E-13,4.0E-13],\n",
       "\"format\":\"g\",\n",
       "\"limits\":[0.0,4.0E-13]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"x\":\"Weight (ng)\",\n",
       "\"y\":\"Radius\",\n",
       "\"label\":\"Symbol\",\n",
       "\"fill\":\"Type\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"alpha\":0.75,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"label\",\n",
       "\"fontface\":\"bold\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"legend_text\":{\n",
       "\"size\":9.0,\n",
       "\"blank\":false\n",
       "},\n",
       "\"axis_text_x\":{\n",
       "\"face\":\"bold\",\n",
       "\"size\":16.0,\n",
       "\"blank\":false\n",
       "},\n",
       "\"legend_key_size\":12.0,\n",
       "\"legend_position\":[0.91,0.82],\n",
       "\"exponent_format\":[\"pow\",-14.0,null]\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"Name\"\n",
       "},{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"Symbol\"\n",
       "},{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"Type\"\n",
       "},{\n",
       "\"type\":\"float\",\n",
       "\"column\":\"Weight (ng)\"\n",
       "},{\n",
       "\"type\":\"float\",\n",
       "\"column\":\"Radius\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"11\"\n",
       "};\n",
       "               window.letsPlotCall(function() {\n",
       "       \n",
       "               var toolbar = null;\n",
       "               var plotContainer = containerDiv;               \n",
       "               \n",
       "                   var options = {\n",
       "                       sizing: {\n",
       "                           width_mode: \"min\",\n",
       "                           height_mode: \"scaled\",\n",
       "                           width: width\n",
       "                       }\n",
       "                   };\n",
       "                   var fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer, options);\n",
       "                   if (toolbar) {\n",
       "                     toolbar.bind(fig);\n",
       "                   }\n",
       "               });\n",
       "               \n",
       "               break;\n",
       "           }\n",
       "       }\n",
       "   });\n",
       "   \n",
       "   observer.observe(containerDiv);\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chemicalElementsPlot + formattedXScale(\"g\") + theme(exponentFormat = listOf(\"pow\", -14, null))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Kotlin",
   "language": "kotlin",
   "name": "kotlin"
  },
  "language_info": {
   "codemirror_mode": "text/x-kotlin",
   "file_extension": ".kt",
   "mimetype": "text/x-kotlin",
   "name": "kotlin",
   "nbconvert_exporter": "",
   "pygments_lexer": "kotlin",
   "version": "1.9.23"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
